// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from '@/App'
// import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
import ElementUI from '@/element-ui'
import '@/assets/scss/index.scss'
import titleMixin from '@/mixin/title'
import keywordsMixin from '@/mixin/keywords'
import descriptionMixin from '@/mixin/description'
import { sync } from 'vuex-router-sync'
import { createStore } from '@/store'
import { createRouter } from '@/router'
import grid from '@/components/grid'
import channel from '@/utils/channel'
import divider from '@/components/divider'
import { timeFormat } from '@/utils/filters'

Vue.use(ElementUI)
Vue.config.productionTip = false
Vue.mixin(titleMixin)
Vue.mixin(keywordsMixin)
Vue.mixin(descriptionMixin)
Vue.component(grid.name, grid)
Vue.component(divider.name, divider)
Vue.prototype.$channel = channel
Vue.filter('timeFilter', timeFormat)

export default function createApp () {
  const store = createStore()
  const router = createRouter()

  sync(store, router)

  const app = new Vue({
    router,
    store,
    render: h => h(App)
  })

  return { app, router, store }
}
